<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			var reg=/dog/gi;
			var str=window.prompt("input a string:");
			//alert(reg.test(str));
			str=str.replace(reg,"Cat");
			alert(str);
		</script>
	</head>
	<body>
	</body>
</html>
